home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
HENSA
/
SCREENSAVER
/
BLANKCTR.ZIP
/
blankctrl
/
ReadMe
< prev
Wrap
Text File
|
1996-04-22
|
5KB
|
128 lines
BlankCtrl Version 1.10 Copyright (C) 1994-1996 Alun Jones, auj@aber.ac.uk
BlankCtrl is Freeware. You may distribute it freely, either alone, or as
part of your own application, under the following conditions:
1) This file must accompany any copy of BlankCtrl distributed - otherwise,
how will people know how to use it?!
2) If you distribute it as part of an application which is Freeware, I'd
love to hear from you, mainly so I can keep people uptodate on any
improvements.
3) If you distribute it as part of a package or collection for which you
charge, I'd like a free copy of the package/collection for myself.
(This is the greed clause ;-)
4) I don't guarantee its suitability for any purpose and disclaim any
responsibility for damage caused by its use or misuse. However, I'll be
glad to try to solve any problems you have using BlankCtrl, and will make
a reasonable effort to keep it uptodate with future versions of
ScreenBlanker.
BlankCtrl is a module which hacks the RISC OS 3.1 and 3.5 screenblanker
modules. It supplies five SWIs:
Blank_Check - Returns R0=1 if the screen is blank, 0 otherwise.
Blank_Blank - Forces the screenblank timer to R0/5 seconds. So,
SYS "Blank_Blank", 5 will make the screen blank in 1s.
Blank_Unblank - Forces the screen to unblank immediately.
The following SWIs provide support for monitoring the state of the
screenblanker from the WIMP.
Blank_ClaimFlag - Returns the address of a flag in R0. This flag can be
used as a WIMP Poll Word. When the screen blanks, the
word is set to 1, when it unblanks, the word is set to
2. You may write to the word. Note that, in order to
make sure that the Poll Word is safe against module
deletion, ClaimFlag locks the module against removal.
Blank_ReleaseFlag - Releases the lock on the flag.
The simple BASIC program below, (also saved in !Demo) gives a demonstration
of how to use these calls to implement an animated screensaver using the
ScreenBlanker to do all the hard work.
Finally, BlankCtrl supplies a trigger for the blanker:
If the mouse pointer is clicked in the bottom left corner of the screen
then, after half a second, the timer set to about 0.2 seconds. This is
useful for forcing the screenblank on when you need to leave the computer or
if you want to force screen DMA off while running something processor
intensive in a high bandwidth screen mode. (of course if you move the mouse
after the 0.5s delay then ScreenBlanker will reset its timer.)
The module works by first checking the screenblanker module version. If the
version number is right then the blanker's module workspace base is read.
The Blank_* SWIs can then read or write to the workspace and subvert
screenblanker's timers.
---------------- Simple demo of Poll Word usage follows
REM >!RunImage
REM Copyright (C) 1996 Alun Jones, auj@aber.ac.uk
REM Simple BlankCtrl Usage example. This uses a poll word
REM to catch the screenblank, then forces it to unblank, and
REM messes around with the contents of the screen until the mouse
REM is moved. Note that while the blanker is running, the computer
REM doesn't multitask. This is only a demo, after all!
REM Claim the screenblank flag - this is used as a poll word.
SYS "Blank_ClaimFlag" TO PW%:!PW%=0
REM Startup task.
DIM block% &100, err% &100
SYS "Wimp_Initialise",300,&4B534154,"BlankCtrl Demo"
ON ERROR PROCError:PROCEnd
quit%=0
REPEAT
REM Wait for Poll word != 0.
SYS "Wimp_Poll",&401973,block%,,PW% TO reason%
CASE reason% OF
REM Poll World reason code
WHEN 13 :
REM !PW=1 => Screen has blanked. 2 => Unblanked (which we ignore).
IF !PW%=1 THEN
REM Silly desktop masher until mouse move. Note, we have to
REM ensure that the screen stays unblanked by calling
REM Blank_UnBlank every now and then.
MOUSE U%,V%,S%
REPEAT
SYS "Blank_UnBlank"
S%=RND(100)
X%=RND(1278-S%):Y%=RND(1020-S%)
DX%=RND(8)-4:DY%=RND(8)-4
RECTANGLE X%,Y%,S%,S% TO X%+DX%,Y%+DY%
MOUSE X%,Y%,S%
UNTIL X%<>U% OR Y%<>V%
REM Restore the screen's original state.
SYS "Wimp_ForceRedraw", -1, 0, 0, 1280, 1024
ENDIF
REM Unset the pollword, ready for the next time.
!PW%=0
WHEN 17,18 :
CASE block%!16 OF
WHEN 0 : quit%=TRUE
ENDCASE
ENDCASE
UNTIL quit%
PROCEnd
END
DEFPROCEnd
SYS "Wimp_CloseDown"
SYS "Blank_ReleaseFlag"
END
ENDPROC
DEF PROCError
!err%=ERR
$(err%+4)=REPORT$+CHR$(0)
SYS"Wimp_ReportError",err% ,1,"BlankCtrl"
ENDPROC